<template>
  <el-dialog
    :append-to-body="true"
    :before-close="cancel"
    :close-on-click-modal="false"
    :title="title"
    :visible.sync="boxDialogVisible"
    class="tree-dialog-form scrollbar selectBox"
    heihgt="607px"
    width="686px"
  >
    <div class="box">
          <div style="height: 93%">
            <el-table :data="tableData" style="width: 100%">
                <el-table-column prop="date" label="日期" width="180">
                </el-table-column>
                <el-table-column prop="name" label="姓名" width="180">
                </el-table-column>
                <el-table-column prop="address" label="地址">
                </el-table-column>
            </el-table>            
          </div>
    </div>

    <div class="dialog-footer" style="text-align: right; padding: 20px">
      <el-button @click="cancel" size="small">取消</el-button>
      <el-button :disabled="disabled" @click="save" size="small" type="primary"
        >确定</el-button
      >
    </div>
  </el-dialog>
</template>

<script>
export default {
  name: "SelectList",
  components: {},
  props: {
    title: {
      type: String,
      default() {
        return "";
      }
    },
    boxDialogVisible: {
      type: Boolean,
      default() {
        return false;
      }
    },
    multi: {
      type: Boolean,
      default() {
        return false;  // 默认单选 
      }
    }
  },
  data() {
    return {
      tableData: [{
            date: '2016-05-02',
            name: '王小虎',
            address: '上海市普陀区金沙江路 1518 弄'
        }, {
            date: '2016-05-04',
            name: '王小虎',
            address: '上海市普陀区金沙江路 1517 弄'
        }, {
            date: '2016-05-01',
            name: '王小虎',
            address: '上海市普陀区金沙江路 1519 弄'
        }, {
            date: '2016-05-03',
            name: '王小虎',
            address: '上海市普陀区金沙江路 1516 弄'
        }], 
      disabled: false
    };
  },
  computed: {},
  mounted() {},
  created() {},

  watch: {
    boxDialogVisible(value) {
      if (value) {
        this.init();
        this.disabled = false;
      }
    }
  },

  methods: {
    /*
      当搜索框对焦时
    */
    onFocus() {
      const search = document.getElementsByClassName("select-box-search")[0];
      search.onclick = () => this.search();
    },
    search() {
    },
    /*
      回车
    */
    enter() {
      return this.search();
    },
    /*
      初始化
    */
    init() {
    },
    cancel() {
      this.$emit("close", false);
    },    
    save() {
      let rtnData = [];
      this.$emit("save", rtnData);
    },

    // 初始化数据
    initData() {
    },
    // 初始化左侧选人组件
    initLeftData() {
    }
  }
};
</script>

<style lang="less">
</style>
